<@t.html>
	<@t.container title="添加用户" icon="users" back="true" >
				<@t.form id="add_form">
					<#if bean??>
        				<input type="hidden" id="id" name="id" value="${bean.id}"/>	
					</#if>
                	<@t.text title="登录名" id="loginName" value="${bean.loginName!''}" />
					<@t.text title="昵称" id="nickname" value="${bean.nickname!''}" />    
					<@t.password title="密码" id="password" value="${bean.password!''}" help="不修改密码，请留空!" />    
					<@t.text title="电话" id="phone" value="${bean.phone!''}" />    
					<@t.text title="电子邮箱" id="email" value="${bean.email!''}" />    
					<@t.select title="性别" id="sex" datas={"1":"男","2":"女"} defaultValue="${bean.sex!''}" />    
					<@t.select title="邮箱状态" id="active" datas={"1":"已激活","0":"未激活"} defaultValue="${bean.active!''}" />    
					<@t.select title="账号状态" id="state" datas={"1":"正常","2":"封号","3":"未激活"} defaultValue="${bean.state!''}" />    
					<@t.text title="生日" id="birthday" value="${bean.birthday!''}" />    
					<@t.text title="真实姓名" id="realname" value="${bean.realname!''}" />    
					<@t.text title="被举报次数" id="warning" value="${bean.warning!''}" />    
					<@t.text title="积分" id="score" value="${bean.score!''}" />    
					<@t.textarea title="个性签名" id="introduction" value="${bean.introduction!''}" />    
                	<@t.uploader title="头像" id="photo" value="${bean.photo!''}" help="上传200*200以上（尺寸比例为1：1）" />
					<@t.submitBtn title="保存"/>
               </@t.form>
	</@t.container>
	<script type="text/javascript">
     $(function(){
    	 //绑定上传
         $('#photo').uploadify();
         //绑定删除缩略图事件
  		$('.js_removeCover').click(function(){
  				$('#preview_img').attr('src','');
  				$('#photo').val('');
  		});
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "loginName": {
        	            rule: "required;<#if ($bean.id =="")>remote[admin/user/checkLoginNameUni]</#if>",
        	            ok: "",
        	            tip:"请填写登录名，由英文，数字，下划线构成.",
        	            msg: {
        	            	required: "登录名不可以为空!",
        	            }
        	        },
        	        "nickname": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写昵称",
        	            msg: {
        	            	required: "昵称不可以为空!",
        	            }
        	        },
        	        "password": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写密码",
        	            msg: {
        	            	required: "密码不可以为空!",
        	            }
        	        },
        	        "email": {
        	            rule: "email;",
        	            ok: "",
        	            tip:"请填写邮箱",
        	            msg: {
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
               $ .axsf('admin/user/add',data,function(d){
			   		if(d){
                         if(d.code==200){
							window.location.href="admin/user/index";
                         }else{
						 	alert(d.message);
						 }
                	}
			   });
        });
});
    </script>
</@t.html>